<?php

/**
 * Created by PhpStorm.
 * User: li
 * Date: 15-12-7
 * Time: 上午11:44
 */
class Region_model extends MY_Model
{
    function __construct(){
        parent::__construct();
        $this->_table_name = 'region';
    }

    function gets_by_parent($parent_code=0){
        $this->db->where('parent_code',$parent_code);
        $query = $this->db->get($this->_table_name);
        if($query->num_rows()>0)
            return $query->result_array();
        return null;
    }

    function gets_by_ids($ids){

        $this->db->select('id,name');
        $this->db->where_in('id',$ids);
        $query = $this->db->get($this->_table_name);
        if($query->num_rows()>0)
            return $query->result_array();
        return null;
    }
}